package cn.hxth.cloud.consumer.util;

import java.util.List;

public class SplitUtil {
    public static  <T> List<T> splitList(List<T> list,int currentPage,int pagesize){
        int size = list.size();

        int fromIndex = pagesize * (currentPage - 1);

        int toIndex = fromIndex + pagesize;

        if (toIndex >= size) {

            toIndex = size;

        }
        return  list.subList(fromIndex,toIndex) ;
    }
}
